function wizardPreview(idWizard){
    $.ajax({
        url: 'index.php/wizardapp/preview/' + idWizard,
        success: function(data) {
            $("#wizard_preview").html(data);
            $('#myModal').modal('show');
        }
    });
}

function saveWizard(data){
    alert(data);
}

function newQuestion(){
    var new_question =
            "<hr />" +
            //Input for title, validation of success when you write something -->
            "<div class='control-group' id=''>" +
                "<label class='control-label' for='input_title'>Title</label>" +
                "<div class='controls'>" +
                    "<input type='text' class='input-large' id='q_title_" + num_questions + "'>" +
                    '<a class="btn btn-small btn-danger" style="margin-left: 20px;" onclick="alert(\'why?\')"><i class="icon-remove icon-white"></i> Delete Question</a>' +
                    "<p class='help-inline'></p>" +
                "</div>" +
            "</div>";
    $(new_question).insertBefore('#new_question');
}

function clearForm(ele) {
    $(ele).find(':input').each(function() {
        switch(this.type) {
            case 'password':
            case 'select-multiple':
            case 'select-one':
            case 'text':
            case 'textarea':
                $(this).val('');
                break;
            case 'checkbox':
            case 'radio':
                this.checked = false;
        }
    });
}

$(document).ready(function() {
    num_questions = 1;
    $("a[rel=derechos_reservados]").popover({
        placement: 'bottom',
        delay: {
            hide: '2000'
        }
    });
});